# Maintainer: Caleb Maclennan <caleb@alerque.com>
# Maintainer: George Rawlinson <grawlinson@archlinux.org>

pkgname=python-pydyf
_commit='33fe462cc7f068fe928896264d189a4d94fcfdbc'
pkgver=0.6.0
pkgrel=2
pkgdesc='A low-level PDF generator'
arch=('any')
url='https://www.courtbouillon.org/pydyf'
license=('BSD')
depends=('python')
makedepends=(
  'git'
  'python-build'
  'python-flit-core'
  'python-installer'
)
checkdepends=(
  'python-pytest'
  'python-pillow'
  'ghostscript'
)
source=("$pkgname::git+https://github.com/CourtBouillon/pydyf.git#commit=$_commit")
b2sums=('SKIP')

pkgver() {
  cd "$pkgname"

  git describe --tags | sed 's/^v//'
}

build() {
  cd "$pkgname"

  python -m build --wheel --no-isolation
}

check() {
  cd "$pkgname"

  pytest
}

package() {
  cd "$pkgname"

  python -m installer --destdir="$pkgdir" dist/*.whl

  install -vDm644 -t "$pkgdir/usr/share/licenses/$pkgname" LICENSE
}
